<!DOCTYPE html>
<html>
<head>
    <meta charset=utf-8>
    <meta name=viewport content="width=device-width,initial-scale=1,user-scalable=0">
    <script src="dsbridge.js"></script>
    <script src="jquery-3.4.1.min.js"></script>
    <script src="jquery.cookie.js"></script>
    <script>
    	//登录
        function login() {
            console.log("login");
            dsBridge.call("__wangwx_jsapi.openIpSet");
        }
        //获取IP
        function getIP() {
            var ip = dsBridge.call("__wangwx_jsapi.getIP");
            alert("ip:" + ip);
        }
        //注销
        function logout() {
            dsBridge.call("__wangwx_jsapi.clearIP");
        }
        //附件上传
        function fileUpload() {
            dsBridge.call("__wangwx_jsapi.fileUpload");
        }
        var resultValue;
        dsBridge.register('fileUploadCallback', function(value) {
            console.log("调用了");
            //alert(value);
            // $.cookie('resultValue', value, {
            //     expires : 7,
            //     path : '/'
            // });
            alert("resultValue:" + value);
            //getReturnValue();
            return "success";
        })

        function getReturnValue() {
            var value = $.cookie('resultValue');
            alert(value);

        }

    </script>
</head>
<body bgcolor="blue">
    <button type="button" onclick="login()">打开登录界面</button>
    <button type="button" onclick="getIP()">获取IP设置</button>
    <button type="button" onclick="logout()">注销</button>
    <button type="button" onclick="fileUpload()">附件上传</button>
    <button type="button" onclick="getReturnValue()">显示value</button>
</body>
</html>